//
//  CommentCell.m
//  zhijian
//
//  Created by lcb on 2019/2/24.
//  Copyright © 2019 lcb. All rights reserved.
//

#import "CommentCell.h"

@interface CommentCell ()<TTTAttributedLabelDelegate>
@end
@implementation CommentCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setup];
    }
    return self;
}
-(void)dealloc
{
    self.lblTitle.delegate=nil;
    self.lblTitle=nil;
    self.userView=nil;
}
-(void)setup{
    
    //
    self.userView =[UserCell new];
    [self.contentView addSubview:self.userView];
    //
    
    self.lblTitle = [[BaseLabel alloc] initWithFrame:CGRectZero];
    self.lblTitle.font = [UIFont systemFontOfSize:16];
    self.lblTitle.numberOfLines = 0;
    self.lblTitle.textColor = UIColorOfHex(0x333333);
    self.lblTitle.linkAttributes = @{NSForegroundColorAttributeName : UIColorOfHex(0x00a5ed)};
    self.lblTitle.delegate= self;
    self.lblTitle.lineSpacing =5;
    [self.contentView addSubview:self.lblTitle];
    

    
}
- (void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url
{
    NSLog(@"notification = %@",  url.absoluteString);
    //    if (self.delegate && [self.delegate respondsToSelector:@selector(didClickTopicInCell:indexPath:)]) {
    //        NSString*string =[url.absoluteString stringByReplacingOccurrencesOfString:@"MiaoTopic://" withString:@""];
    //        string =[string stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    //
    //        NSLog(@"replaceStr=%@",string);
    //        [self.delegate didClickTopicInCell:string indexPath:self.sd_indexPath];
    //    }
}
@end
